<div class="hbox hbox-auto-xs hbox-auto-sm" ng-init="
    app.settings.asideFolded = false;
    app.settings.asideDock = false;
  ">
    <!-- main -->
    <div class="col">
        <!-- main header -->
        <div class="bg-light lter b-b wrapper-md">
            <div class="row">
                <div class="col-sm-6 col-xs-12" ng-controller="ansibleVersionCtrl">
                    <h1 class="m-n font-thin h3 text-black">
                        <i>
                            <embed src="img/simpleicons/ansible-wordmark.svg" width="100" height="35"
                                   type="image/svg+xml"
                                   pluginspage="img/simpleicons/"></embed>
                        </i>
                        <button ng-click="ansibleVersion()"
                                class="btn btn-xs"
                                style="margin-left: 5px; background-color: #00a8f3; color: white;">
                            <span class="icon icon-info"></span> Version
                        </button>
                    </h1>
                    <small class="text-muted">自定义生成Ansible主机配置文件</small>
                </div>
            </div>
        </div>
        <!-- / main header -->
        <div class="wrapper-md">
            <!-- toaster directive -->
            <toaster-container
                    toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>
            <!-- / toaster directive -->

            <uib-tabset>
                <div class="panel panel-default" ng-controller="ansibleHostConfigCtrl">
                    <div class="panel-body">
                        <div>
                            <form class="form-inline" role="form">
                                <div class="form-group">
                                    <button
                                            type="button" class="btn btn-success" ng-click="pageChanged()"><span
                                            class="glyphicon glyphicon-repeat"></span>查询
                                    </button>

                                    <button type="button" class="btn btn-success" ng-click="addItem()"><span
                                            class="glyphicon glyphicon-plus"></span>新增
                                    </button>
                                </div>
                            </form>
                        </div>
                        <div style="margin-top: 5px;">
                            <table class="table table-hover table-bordered table-striped">
                                <thead>
                                <tr>
                                    <td>文件组名</td>
                                    <td class="col-md-6">配置文件</td>
                                    <td>使用类型</td>
                                    <td>操作</td>
                                </tr>
                                </thead>
                                <tbody>
                                <tr ng-repeat="item in pageData">
                                    <td>{{item.fileGroupDO.groupName}}</td>
                                    <td>
                                        <b style="color: #777">{{item.filePath}}</b>
                                        </br>
                                        <b style="color: #286090">{{item.fileName}}</b>
                                        <b class="pull-right">{{item.fileDesc}}</b>
                                    </td>
                                    <td>
                                        <b style="color: #f4ca06"
                                           ng-if="item.useType == 0 || item.useTypeDO == null">all</b>
                                        <b ng-if="item.useType == 10">{{item.useTypeDO.typeName}}</b>
                                        <b ng-if="item.useType == 1">{{item.useTypeDO.typeName}}</b>
                                        <b style="color: #990000"
                                           ng-if="item.useType == 2">{{item.useTypeDO.typeName}}</b>
                                        <b style="color: #ec971f"
                                           ng-if="item.useType == 3">{{item.useTypeDO.typeName}}</b>
                                        <b ng-if="item.useType == 4">{{item.useType.typeName}}</b>
                                        <b ng-if="item.useType == 5">{{item.useType.typeName}}</b>
                                        <b style="color: #286090"
                                           ng-if="item.useType == 6">{{item.useTypeDO.typeName}}</b>
                                        <b style="color: #d9534f"
                                           ng-if="item.useType == 7">{{item.useTypeDO.typeName}}</b>
                                        <b style="color: #449d44"
                                           ng-if="item.useType == 8">{{item.useTypeDO.typeName}}</b>
                                        <b style="color: #5bc0de"
                                           ng-if="item.useType == 9">{{item.useTypeDO.typeName}}</b>
                                        <b style="color: black"
                                           ng-if="item.useType > 9">{{item.useTypeDO.typeName}}</b>
                                    </td>
                                    <td>
                                        <button ng-click="editItem(item)"
                                                class="btn btn-xs"
                                                ng-disabled="butEditDisabled"
                                                style="margin-left: 5px; background-color: #2e6da4; color: white;">
                                            <i class="glyphicon glyphicon-edit"></i>编辑
                                        </button>

                                        <button ng-click="launchItem(item.id)"
                                                class="btn btn-xs"
                                                style="margin-left: 5px; background-color: limegreen; color: white;">
                                            <span class="glyphicon glyphicon-search"></span>预览
                                        </button>

                                        <button ng-click="createItem(item.id)"
                                                class="btn btn-xs"
                                                ng-disabled="butSaveDisabled"
                                                style="margin-left: 5px; background-color: #ff8700; color: white;">
                                            <i class="fa fa-spin fa-spinner" ng-show="butSaveSpinDisabled"></i>
                                            <i class="glyphicon glyphicon-save" ng-show="!butSaveSpinDisabled"></i>保存
                                        </button>

                                        <button ng-click="invokeItem(item.id)" ng-show="false"
                                                class="btn btn-xs"
                                                ng-disabled="butInvokeDisabled"
                                                uib-popover-html="'同步配置并生效'" popover-trigger="'mouseenter'"
                                                style="margin-left: 5px; background-color: #ff5f87; color: white;">
                                            <i class="fa fa-spin fa-spinner" ng-show="butInvokeSpinDisabled"></i>
                                            <i class="icon icon-control-play" ng-show="!butInvokeSpinDisabled"></i>执行
                                        </button>

                                        <button ng-click="delItem(item.id)"
                                                class="btn btn-xs pull-right"
                                                ng-disabled="butDelDisabled"
                                                style="background-color: red; color: white;">
                                            <i class="glyphicon glyphicon-remove"></i>删除
                                        </button>
                                    </td>
                                </tr>
                                </tbody>
                                <tfoot>
                                <tr>
                                    <td colspan="10">
                                        <ul style="margin: 0px; float: right;" uib-pagination
                                            total-items="totalItems" ng-model="currentPage"
                                            items-per-page="pageLength" max-size="10" ng-change="pageChanged()"
                                            previous-text="&lsaquo;" next-text="&rsaquo;"></ul>
                                    </td>
                                </tr>
                                </tfoot>
                            </table>
                        </div>
                    </div>
                </div>
            </uib-tabset>
        </div>
    </div>
    <!-- / main -->
</div>


<script type="text/ng-template" id="versionInfoModal">
    <div ng-include="'tpl/modal/ansible_version_info_modal.html'"></div>
</script>

<script type="text/ng-template" id="configFile">
    <div ng-include="'tpl/modal/configFile/ansible_config_file_modal.html'"></div>
</script>


<script type="text/ng-template" id="configFileInfo">
    <div ng-include="'tpl/modal/configFile/config_file_info_modal.html'"></div>
</script>